#set(title='订单详情',menu='order',statusMap={'1':'待买家付款','2':'待发货','3':'待买家确认收货','4':'交易完成','5':'交易关闭'})
#@user_layout()
#define user_main()
	 <h1 class="page-header">#(title)</h1>
	 	<div class="row">
			<ol class="breadcrumb">
			  <li><a href="#(ctx)/order/list">订单管理</a></li>
			  <li class="active">订单详情</li>
			</ol>
		</div>
	 	<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">订单基本信息 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="text-success">#(statusMap[order.status+''])</span></h3>
			</div>
			<div class="panel-body">
				<div class="row">
					<div class="col-sm-2 control-label"><p>订单编号</p></div>
					<div class="col-sm-4 text-left"><p>#(order.id)</p></div>
					<div class="col-sm-2 control-label"><p>下单时间</p></div>
					<div class="col-sm-4 text-left"><p>#(order.createTime)</p></div>
				</div>
				<div class="row">
					<div class="col-sm-2 control-label"><p>支付时间</p></div>
					<div class="col-sm-4 text-left"><p>#(order.payTime)</p></div>
					<div class="col-sm-2 control-label"><p>发货时间</p></div>
					<div class="col-sm-4 text-left"><p>#(order.deliveryTime)</p></div>
				</div>
				<div class="row">
					<div class="col-sm-2 control-label"><p>邮寄地址</p></div>
					<div class="col-sm-10 text-left"><p>#(order.address) #(order.name) #(order.mobile)</p></div>
				</div>
			</div>
		</div>
	 	<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">订单明细</h3>
			</div>
			<div class="panel-body">
				<div class="table-responsive">
		            <table class="table table-striped ">
		              <caption class="text-danger">订单总金额：#(order.total)（元）</caption>
		              <thead>
		                <tr>
		                  <th>序号</th>
		                  <th>书名</th>
		                  <th>价格（元）</th>
		                  <th>数量</th>
		                  <th>总价（元）</th>
		                   <th></th>
		                </tr>
		              </thead>
		              <tbody>
		              	#for(x : order.getItems())
		             	<tr>
		                  <td>#(for.index+1)</td>
		                  <td><a href="#(ctx)/book/detail/#(x.bookId)"><img src="#(uploadPah)#(x.book.bookImg)" alt="book image" width="70px"></a>
	              				<a href="#(ctx)/book/detail/#(x.bookId)">#(x.book.name)</a></td>
		                  <td>¥#(x.price)</td>
			              <td>#(x.num)</td>
			              <td>¥#(x.total)</td>
			              <td>
			              	#if(session.session_user.type == 0 && order.status == 4 && x.status == 1)
			              		<button type="button" class="btn btn-info" id="soldBookBtn-#(x.id)" data-toggle="modal" data-target=".soldBook-modal">我要卖书</button>
			              		<button type="button" class="btn btn-warning" id="exchBookBtn-#(x.id)" data-toggle="modal" data-target=".exchBook-modal">我要换书</button>
			              		<input type="hidden" id="name-#(x.id)" value="#(x.book.name)" />
			              		<input type="hidden" id="price-#(x.id)" value="#(x.price)" />
			              		<input type="hidden" id="num-#(x.id)" value="#(x.num)" />
			              		<input type="hidden" id="total-#(x.id)" value="#(x.total)" />
			              	#end
			              </td>
		                </tr>
		                #end
		              </tbody>
		            </table>
		          </div>
			</div>
		</div>
  <div class="modal fade soldBook-modal" tabindex="-1" role="dialog">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title">我要卖书</h4>
	      </div>
	      <div class="modal-body">
	      	<form id="soldBookForm" class="form-horizontal" method="post">
				  <div class="form-group">
				    <label class="col-sm-3 control-label">书名</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="name"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">价格</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="price"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">数量</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="num"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">原总价</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="total"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">售出价格</label>
				    <div class="col-sm-6">
				      <input type="number" name="soldTotal" id="soldTotal" class="form-control" placeholder="" required>
				    </div>
				  </div>
				  <input type="hidden" name="orderItemId" id="orderItemId" value="" />
				</form>
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	        <button type="button" class="btn btn-primary" id="soldBookBtn">确定</button>
	      </div>
	    </div><!-- /.modal-content -->
	  </div><!-- /.modal-dialog -->
	</div><!-- /.modal -->   
	
	<div class="modal fade exchBook-modal" tabindex="-1" role="dialog">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title">我要换书</h4>
	      </div>
	      <div class="modal-body">
	      	<form id="exchBookForm" class="form-horizontal" method="post">
				  <div class="form-group">
				    <label class="col-sm-3 control-label">书名</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="name"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">价格</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="price"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">数量</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="num"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">总价</label>
				    <div class="col-sm-6">
				      <p class="form-control-static" id="total"></p>
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">收货人姓名</label>
				    <div class="col-sm-8">
				    	<input type="text" class="form-control" name="name" value="#(user.name)">
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">收货人电话</label>
				    <div class="col-sm-8">
				    	<input type="text" class="form-control" name="mobile" value="#(user.mobile)">
				    </div>
				  </div>
				  <div class="form-group">
				    <label class="col-sm-3 control-label">收货人地址</label>
				    <div class="col-sm-8">
				    	<input type="text" class="form-control" name="address" value="#(user.address)">
				    </div>
				  </div>
				  <input type="hidden" name="orderItemId" id="orderItemId" value="" />
				</form>
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	        <button type="button" class="btn btn-primary" id="exchBookBtn">确定</button>
	      </div>
	    </div><!-- /.modal-content -->
	  </div><!-- /.modal-dialog -->
	</div><!-- /.modal -->   
#end
